AS=/usr/local/mips-cross/bin/mipsel-elf-as
CC=/usr/local/mips-cross/bin/mipsel-elf-gcc
LD=/usr/local/mips-cross/bin/mipsel-elf-ld
OBJCOPY=/usr/local/mips-cross/bin/mipsel-elf-objcopy
OBJDUMP=/usr/local/mips-cross/bin/mipsel-elf-objdump

all:
	$(AS) -mips1 hello.S -o hello.o -EL 
	$(LD) -mips1 -T ../../lib/default.ld hello.o -o hello.elf -EL
	$(OBJCOPY) -j .startup.bootvec -j .startup -O binary hello.elf hello.bin
	hexdump -e "1/4 \"%08x\n\"" hello.bin -v > hello.hex
	cat ../../lib/nops.hex >> hello.hex
	
dump:
	$(OBJDUMP) -j .startup.bootvec -j .startup -D hello.elf

symbols:
	$(OBJDUMP) -t hello.elf

sections:
	$(OBJDUMP) -h hello.elf

clean:
	rm -f hello.bin hello.elf hello.hex hello.o
